package cn.me.implement.threadpool.reject;

import cn.me.implement.threadpool.JaneThreadPool;

/**
 * <strong>丢弃任务队列中最旧任务</strong> 的拒绝策略
 */
public class DiscardOldestRejectPolicy implements RejectPolicy {

    @Override
    public void reject(Runnable rejectTask, JaneThreadPool threadPool) {
        threadPool.pollOldestTask();
        threadPool.execute(rejectTask);
    }
}
